<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="naver.NaverShopping"%>
<%@ page import="naver.ShoppingData"%>
<%@ page import="java.util.*"%>

<h1>쇼핑 정보</h1>
<%
	request.setCharacterEncoding("UTF-8");
	String query = request.getParameter("query");
	// 한글의 경우 인코딩 되서 넘어옵니다. 디코딩해보죠
%>
쿼리 :
<%=query%>

<table border="1">
	<%
		NaverShopping ns = new NaverShopping();
		ns.sendRequest(query);
		ArrayList<ShoppingData> data = new ArrayList<ShoppingData>();
		data = ns.dataList;
	%>
	<%
		for (ShoppingData shopping : data) {
	%><tr>
		<td><%=shopping.title%></td>
		<td><a href="<%=shopping.link%>">사러가기</a></td>
		<td><img src="<%=shopping.image%>" width="200"></td>
		<td><%=shopping.lprice%></td>
		<td><%=shopping.hprice%></td>
		<td><%=shopping.mallName%></td>
		<td><%=shopping.productId%></td>
		<td><%=shopping.productType%></td>
	</tr>
	<%
		}
	%>
</table>
